/**
 * 微信iDC商城 - 模版
 * @module wechatMall/tpl
 * @author pmkx2 (185832959@qq.com)
 */
define('idc/tpl', [], function(){

	//模版
	var tpl = {
		//推送订单：商品列表
		pushGoodList : {
			//内容框
			box: [
				'{{ if !isHaveOrder }}',
					'<div class="view-box auto-height pd-headbar-2">',
						'<div class="view-box-container">',
							'{{ if goodsList && goodsList.length > 0 }}',

								'<!-- 商品框 -->',
								'<div class="goods-list-box auto-laout-box laout-row">',
									'<div class="auto-laout-left col-1_5 scroll-touch">',
										'<ul class="goods-type">',
											'{{ each goodsList as list i }}',
												'<li data-typeid="{{ list.typeId }}" class="{{ i==0 ? "current" : ""; }}"><a href="javascript:void(0);" data-index="{{ list.index }}" data-run="pushGoods">{{ list.type }}</a></li>',
											'{{ /each }}',
										'</ul>',
									'</div>',
									
									'<div class="auto-laout-right goods-list col-8_5">',
										'{{ each goodsList as list i }}',
											'<div data-index="{{i}}" data-typeid="{{list.typeId}}" data-page="1" class="bd-cont scroll-touch {{i==0 ? "current" : ""}}">',
												'{{if list.goods && list.goods.length > 0 }}',
													'<ul class="product-list">',
														'{{ each list.goods as good j }}',
															'<li id="PushGoodLiType_{{good.id}}" data-ref="PushGoodLiAll_{{good.id}}" data-typeid="{{good.typeId}}" data-id="{{good.id}}" class="{{good.goodStu}}" data-goodtype="og" data-state="{{ good.state==true ? "true" : "false"; }}">',
															'<div class="photo" data-id="{{good.goodsNo}}" data-goodtype="og">',
																'<span class="icon"><i class="icon-common icon-va-mid icon_goods_selected_not cancel"></i><i class="icon-common icon-va-mid icon_goods_selected selected"></i></span>',
																'<img src="{{good.imgURL}}" alt="{{good.name}}" data-original="{{imgURL}}" class="lazy"/>',
															'</div>',
															'<div class="info">',
																'<div class="name">{{good.name}}</div>',
																'<div class="price">',
																	'<span class="c-red">¥{{good.prePrice}}</span>/{{good.pkgUnit}} ',
																	'<!--<s class="f12px c-grey">¥{{good.price}}</s>-->',
																'</div>',
																'<div class="spec c-grey">{{good.spec}}</div>',
																'<div class="recom c-orange hide">推荐数量：{{good.saleVol}}</div>',
																'<div class="buy">',
																	'<a href="javascript:void(0);" class="reduce" data-id="{{good.goodsNo}}" data-min="{{good.minimumVol}}" data-max="{{good.highestVol}}" data-goodtype="og">－</a><input ',
																	'id="PushGoodType_{{good.id}}" ',
																	'type="tel" ',
																	'readonly ',
																	'class="num" ',
																	'value="1" ',
																	'data-goodtype="og"',
																	'data-price="{{good.price}}" ',
																	'data-preprice="{{good.prePrice}}" ',
																	'data-ref="PushGoodAll_{{good.id}}" data-min="{{good.minimumVol}}" ',
																	'data-max="{{good.highestVol}}" ',
																	'data-spec="{{good.spec}}"',
																	'data-id="{{good.id}}" ',
																	'data-imgUrl="{{good.imgURL}}"',
																	'data-goodsName="{{good.name}}"',
																	'data-unit="{{good.pkgUnit}}"',
																	'disabled/><a href="javascript:void(0);" class="add" data-id="{{good.goodsNo}}" data-min="{{good.minimumVol}}" data-max="{{good.highestVol}}" data-goodtype="og">＋</a>',
																'</div>',
															'</div>',
															'</li>',
														'{{ /each }}',
													'</ul>',
													'<p align="center" class="loading-data c-grey hide">商品加载中...</p>',
												'{{ else }}',
													'<div class="prompt-msg">此品类下没有商品</div>',
												'{{ /if }}',
											'</div>',
										'{{ /each }}',
									'</div>',
									'<div class="fix-toolbar">',
										'<div class="fix-container laout-row">',
											'<!--',
											'<div class="col-6">',
												'<div class="total-price-box">',
													'<div class="total-now-price c-orange">',
														'¥<span id="TotalPushPrice">0.00</span>',
													'</div>',
													'<div class="total-og-price">',
														'<s>¥<span id="TotalPushPriceOG">0.00</span></s>&nbsp;|&nbsp;<span data-discount="{{pushGoodsDiscount}}">{{pushGoodsDiscountText}}</span><br><span>共<span id="AllPushSku" class="c-orange">0</span>个单品</span>',
													'</div>',
												'</div>',
											'</div>',
											'<div class="col-4">',
												'<a a-if="{{canSubmitPushGoods == true}}" id="PushGoodsSubmit" href="javascript:void(0);" class="one-btn one-btn-green"><i class="icon-common icon-va-mid icon_state_min_correct"></i>&nbsp;确认订单</a>',
												'<a a-if="{{canSubmitPushGoods == false}}" id="PushGoodsSubmit" href="javascript:void(0);" class="one-btn disabled"><i class="icon-common icon-va-mid icon_state_list"></i>&nbsp;订单过期</a>',
											'</div>',
											'-->',
											'<div class="col-7" style="width:75%;">',
												'<div class="total-price-box">',
													'<div class="total-now-price c-orange">',
														'<div style="font-size:12px; line-height:1.3; padding-left:10px;">',
															'<span>实付金额</span><br>',
															'<span style="line-height:14px;">¥ <span id="TotalPushPrice" class="f18px">0.00</span></span><br>',
															'<span class="c-black">共<span id="AllPushSku" class="c-orange">0</span>个单品</span>',
														'</div>',
													'</div>',
													'<div class="total-og-price">',
														'<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;本单金额 : <span id="TotalPushPriceOG">0.00</span></span><br>',
														'<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;可用返利 : <span id="ReturnPrice" class="c-orange">0.00</span></span><br>',
														'<span>7天累计金额 : <span id="CumulativePrice" class="c-orange">0.00</span>',
														'<!--',
														'&nbsp;|&nbsp;<span data-discount="{{pushGoodsDiscount}}">{{pushGoodsDiscountText}}</span><br>',
														'-->',
													'</div>',
												'</div>',
											'</div>',
											'<div class="col-3" style="width:25%;">',
												'{{ if canSubmitPushGoods == true }}',
													'<span>',
														'<a id="ShowOrderPreview" href="javascript:void(0);" class="one-btn one-btn-orange-sub one-btn-50p">订单预览</a>',
														'<a id="PushGoodsSubmit" href="javascript:void(0);" class="one-btn one-btn-orange one-btn-50p">确认订单</a>',
													'</span>',
												'{{ else }}',
													'<a id="PushGoodsSubmit" href="javascript:void(0);" class="one-btn disabled">订单过期</a>',
												'{{ /if }}',
											'</div>',
										'</div>',
									'</div>',
									
								'</div>',
								'<!-- / 商品框 -->',

							'{{ else }}',

								'<div id="PushGoodsErrMsg" class="prompt-msg">暂无优选订单</div>',

							'{{ /if }}',
						'</div>',
					'</div>',
				'{{ else }}',
			
					'<!-- 今日已下单 -->',
					'<div id="HaveOrder" class="view-box auto-height">',
						'<div class="view-box-container scroll-touch">',
							'<!--',
							'<div class="title-bar"><i class="glyphicon glyphicon-exclamation-sign"></i>&nbsp;今日已下单</div>',
							'<div class="title-content clearfix">',
								'<span class="fl"><i class="glyphicon glyphicon-book c-orange"></i>&nbsp; 送货日期：2016-01-13</span>',
								'<button type="button" class="btn btn-info"><i class="glyphicon glyphicon-earphone"></i>&nbsp; 联系客服</button>',
							'</div>',
							'-->',
							'<div class="context-item-box">',
								'<div class="context-container">',
									'<p class="clearfix">订单状态：{{todayPushGoodsOrder.orderInfo.orderStatus}}',
										'<span class="fr"><a href="tel:400-6555-911" type="button" class="btn btn-link btn-xs"><i class="glyphicon glyphicon-earphone"></i>&nbsp; 联系客服</a></span>',
									'</p>',
									'<!--',
									'<p>订单编号：{{todayPushGoodsOrder.orderInfo.orderId}}</p>',
									'-->',
									'<p>送货日期：{{todayPushGoodsOrder.orderInfo.dryTime}}</p>',
									'<!--<p>下单日期：</p>-->',
									'<p>收货人：{{todayPushGoodsOrder.orderInfo.consignee}}</p>',
									'<p>联系电话：{{todayPushGoodsOrder.orderInfo.phone}}</p>',
									'<p>收货地址：{{todayPushGoodsOrder.orderInfo.address}}</p>',
									'<p>订单金额：¥{{todayPushGoodsOrder.orderInfo.disAmount}}</p>',
									'<p>支付方式：{{todayPushGoodsOrder.orderInfo.payWay}}</p>',
								'</div>',
							'</div>',
							'<div class="context-item-box">',
								'<h3 class="context-head">已购单品（共<span class="c-orange">{{todayPushGoodsOrder.orderInfo.sku}}</span>种）</h3>',
								'<div class="context-container">',
									'<div class="goto-goods-item-desc goods-item-img clearfix">',
										'<div class="imgs">',
											'{{ each todayPushGoodsOrder.goodsList as good i }}',
												'{{ if i < 10}}',
													'<img src="{{good.imgURL}}"/>',
												'{{ /if }}',
											'{{ /each }}',
										'</div>',
										'<span class="goto"><i class="glyphicon glyphicon-menu-right"></i></span>',
									'</div>',
								'</div>',
							'</div>',
							'<!--',
							'<div a-if="{{todayPushGoodsOrder.orderInfo.isCancel == true}}" class="context-item-box">',
								'<div class="context-container">',
									'<p align="right">',
										'<button type="button" class="btn btn-danger cancel-order {{todayPushGoodsOrder.orderInfo.isCancel == true ? "" : "disabled"}}" data-devDay="{{todayPushGoodsOrder.orderInfo.dryTime}}" data-form="HaveOrder" data-orderId="{{todayPushGoodsOrder.orderInfo.orderId}}">取消订单</button>',
									'</p>',
								'</div>',
							'</div>',
							'-->',
						'</div>',
					'</div>',
					'<!-- / 今日已下单 -->',

				'{{ /if }}'
			].join(''),
			//选项
			item: [
				'{{ if data && data.length > 0 }}',
					'{{ each data as good j }}',
						'<li id="PushGoodLiType_{{good.id}}" data-ref="PushGoodLiAll_{{good.id}}" data-typeid="{{good.typeId}}" data-id="{{good.id}}" class="{{good.goodStu}}" data-goodtype="og" data-state="{{ good.state==true ? "true" : "false"; }}">',
						'<div class="photo" data-id="{{good.goodsNo}}" data-goodtype="og">',
							'<span class="icon"><i class="icon-common icon-va-mid icon_goods_selected_not cancel"></i><i class="icon-common icon-va-mid icon_goods_selected selected"></i></span>',
							'<img src="{{good.imgURL}}" alt="{{good.name}}" data-original="{{imgURL}}" class="lazy"/>',
						'</div>',
						'<div class="info">',
							'<div class="name">{{good.name}}</div>',
							'<div class="price">',
								'<span class="c-red">¥{{good.prePrice}}</span>/{{good.pkgUnit}} ',
								'<!--<s class="f12px c-grey">¥{{good.price}}</s>-->',
							'</div>',
							'<div class="spec c-grey">{{good.spec}}</div>',
							'<div class="recom c-orange hide">推荐数量：{{good.saleVol}}</div>',
							'<div class="buy">',
								'<a href="javascript:void(0);" class="reduce" data-id="{{good.goodsNo}}" data-min="{{good.minimumVol}}" data-max="{{good.highestVol}}" data-goodtype="og">－</a><input ',
								'id="PushGoodType_{{good.id}}" ',
								'type="tel" ',
								'readonly ',
								'class="num" ',
								'value="1" ',
								'data-goodtype="og"',
								'data-price="{{good.price}}" ',
								'data-preprice="{{good.prePrice}}" ',
								'data-ref="PushGoodAll_{{good.id}}" data-min="{{good.minimumVol}}" ',
								'data-max="{{good.highestVol}}" ',
								'data-spec="{{good.spec}}"',
								'data-id="{{good.id}}" ',
								'data-imgUrl="{{good.imgURL}}"',
								'data-goodsName="{{good.name}}"',
								'data-unit="{{good.pkgUnit}}"',
								'disabled/><a href="javascript:void(0);" class="add" data-id="{{good.goodsNo}}" data-min="{{good.minimumVol}}" data-max="{{good.highestVol}}" data-goodtype="og">＋</a>',
							'</div>',
						'</div>',
						'</li>',
					'{{ /each }}',
				'{{ /if }}',
			].join(''),
		},

		//自由订单：商品列表
		independentOrderList : {
			//内容框
			box: [
			'<div data-index="" data-typeid="" data-page="1" class="bd-cont scroll-touch current">',
				'{{ if data && data.length > 0 }}',
					'{{ if data[0] && data[0].catNoId==33 }}',
						'<div class="alert alert-dismissible fade in alert-grey" role="alert">',
	      					'<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>“特卖”商品根据用户选择的剩余效期随机发货，不能退货！',
	      				'</div>',
      				'{{ /if}}',
					'<ul class="product-list">',
					'</ul>',
					'<p align="center" class="loading-data c-grey">商品加载中...</p>',
				'{{ else }}',
					'<div class="prompt-msg">此品类下没有商品</div>',
				'{{ /if}}',
			'</div>',
			].join(''),
			//选项
			item: [
				'{{ if data && data.length > 0 }}',
					'{{ each data as good i }}',
						'<li id="IndependentOrderGoodLiType_{{good.goodsNo}}" data-catNo="{{good.catNoId}}" data-typeid="{{good.catNoM}}" data-id="{{good.goodsNo}}" data-goodtype="independent" data-state="{{ good.state==true ? "true" : "false"; }}" class="{{ good.userSelected==true ? "user-selected" : ""; }}">',
							'<div class="photo" data-id="{{good.goodsNo}}" data-goodtype="independent">',
								'<span class="icon">',
									'<i class="icon-common icon-va-mid icon_goods_selected_not cancel"></i>',
									'<i class="icon-common icon-va-mid icon_goods_selected selected"></i>',
								'</span>',
								'<i class="{{good.catNoId==33 ? "icon-common icon_state_temp temp" : ""}}"></i>',
								'<img src="{{good.bigImgUrl}}" alt="{{good.goodsName}}" data-original="{{good.bigImgUrl}}" class="lazy"/>',
							'</div>',
							'<div class="info">',
								'<div class="name">{{good.goodsName}}</div>',
								'<div class="price">',
									'<span class="c-red">¥{{good.disPrice}}</span>/{{good.pkgUnit}} ',
									'<s class="f12px c-grey">¥{{good.price}}/{{good.pkgUnit}}</s>',
								'</div>',
								'<div class="spec c-grey">',
									'{{good.goodsSpec}} &nbsp;<span class="inventory{{ good.stockQty>0 ? " c-grey" : " c-orange"; }}">{{ good.stockQty>0 ? ("库存："+good.stockQty) : "库存不足"; }}</span>',
								'</div>',
								'{{ if good.catNoId==33 }}',
									'<div class="spec c-red">',
										'剩余效期{{good.validityScope}}',
									'</div>',
								'{{ /if }}',
								'<div class="buy">',
									'<a href="javascript:void(0);" class="reduce" data-id="{{good.goodsNo}}" data-min="1" data-max="{{good.stockQty}}" data-goodtype="independent">－</a><input ',
									'id="IndependentOrderGoodLiTypeNum_{{good.goodsNo}}" ',
									'type="tel" ',
									'maxlength="3" ',
									'readonly ',
									'class="num" ',
									'value="{{good.nowQty}}" ',
									'data-goodtype="independent" ',
									'data-price="{{good.disPrice}}" ',
									'data-preprice="{{good.price}}" ',
									'data-ref="IndependentOrderGoodLiAll_{{good.goodsNo}}" data-min="1" ',
									'data-max="{{good.stockQty}}" ',
									'data-spec="{{good.goodsSpec}}"',
									'data-id="{{good.goodsNo}}" ',
									'data-imgUrl="{{good.bigImgUrl}}"',
									'data-goodsName="{{good.goodsName}}"',
									'data-unit="{{good.pkgUnit}}" ',
									'{{good.userSelected==true ? "" : "disabled"}}/><a href="javascript:void(0);" class="add" data-id="{{good.goodsNo}}" data-min="1" data-max="{{good.stockQty}}" data-goodtype="independent">＋</a>',
								'</div>',
							'</div>',
						'</li>',
					'{{ /each }}',
				'{{ /if }}',
			].join(''),
		},

		//自由订单：搜索商品列表
		searchIndependentGoodsList : {
			//内容框
			box: [
				'{{ if !data }}',
					//还没有开始搜索
					'<div class="prompt-msg">点击“搜索”显示结果</div>',
				'{{ else if data && data.length > 0 }}',
					//搜索结果商品框
					'<ul class="product-list">',
					'</ul>',
				'{{ else if data && data.length == 0 }}',
					//没有搜索结果
					'<div class="prompt-msg">没有您搜索的商品</div>',
				'{{ /if }}',
			].join(''),
			//选项
			item: [
				'{{ if data && data.length > 0 }}',
					'{{ each data as good i }}',
						'<li id="SearchIndependentGoodLiType_{{good.goodsNo}}" data-ref="IndependentOrderGoodLiType_{{good.goodsNo}}" data-typeid="{{good.catNoM}}" data-id="{{good.goodsNo}}" data-goodtype="search" data-state="{{ good.state==true ? "true" : "false"; }}" class="{{ good.userSelected==true ? "user-selected" : ""; }}">',
							'<div class="photo" data-id="{{good.goodsNo}}" data-goodtype="search">',
								'<span class="icon"><i class="icon-common icon-va-mid icon_goods_selected_not cancel"></i><i class="icon-common icon-va-mid icon_goods_selected selected"></i></span>',
				'<i class="{{good.catNoId==33 ? "icon-common icon_state_temp temp" : ""}}"></i>',
								'<img src="{{good.bigImgUrl}}" alt="{{good.goodsName}}" data-original="{{good.bigImgUrl}}" class="lazy"/>',
							'</div>',
							'<div class="info">',
								'<div class="name">{{good.goodsName}}</div>',
								'<div class="price">',
									'<span class="c-red">¥{{good.disPrice}}</span>/{{good.pkgUnit}} ',
									'<!--<s class="f12px c-grey">¥{{good.price}}</s>-->',
								'</div>',
								'<div class="spec c-grey">{{good.goodsSpec}}</div>',
								'<div class="inventory{{ good.stockQty>0 ? " c-grey" : " c-orange"; }}">{{ good.stockQty>0 ? ("库存："+good.stockQty) : "库存量不足"; }}</div>',
								'<div class="buy">',
									'<a href="javascript:void(0);" class="reduce" data-id="{{good.goodsNo}}" data-min="1" data-max="{{good.stockQty}}" data-goodtype="search">－</a><input ',
									'id="SearchGoodType_{{good.goodsNo}}" ',
									'type="tel" ',
									'maxlength="3" ',
									'readonly ',
									'class="num" ',
									'value="{{good.nowQty}}" ',
									'data-goodtype="search"',
									'data-price="{{good.disPrice}}" ',
									'data-preprice="{{good.price}}" ',
									'data-ref="IndependentOrderGoodLiTypeNum_{{good.goodsNo}}" data-min="1" ',
									'data-max="{{good.stockQty}}" ',
									'data-spec="{{good.goodsSpec}}"',
									'data-id="{{good.goodsNo}}" ',
									'data-imgUrl="{{good.bigImgUrl}}"',
									'data-goodsName="{{good.goodsName}}"',
									'data-unit="{{good.pkgUnit}}" ',
									'{{good.userSelected==true ? "" : "disabled"}}/><a href="javascript:void(0);" data-id="{{good.goodsNo}}" class="add" data-min="1" data-max="{{good.stockQty}}" data-goodtype="search">＋</a>',
								'</div>',
							'</div>',
						'</li>',
					'{{ /each }}',
				'{{ /if }}',
			].join('')
		}
	};
	return tpl;
});